package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ProductSpecificationMapper;
import com.ruoyi.system.domain.ProductSpecification;
import com.ruoyi.system.service.IProductSpecificationService;

/**
 * 商品规格 Service业务层处理
 *
 * @author ruoyi
 * @date 2025-05-24
 */
@Service
public class ProductSpecificationServiceImpl implements IProductSpecificationService
{
    @Autowired
    private ProductSpecificationMapper productSpecificationMapper;

    /**
     * 通过id查询商品规格
     *
     * @param id 商品规格主键
     * @return 商品规格
     */
    @Override
    public ProductSpecification selectProductSpecificationById(Long id)
    {
        return productSpecificationMapper.selectProductSpecificationById(id);
    }

    /**
     * 查询商品规格列表
     *
     * @param productSpecification 商品规格
     * @return 商品规格
     */
    @Override
    public List<ProductSpecification> selectProductSpecificationList(ProductSpecification productSpecification)
    {
        return productSpecificationMapper.selectProductSpecificationList(productSpecification);
    }

    /**
     * 新增商品规格
     *
     * @param productSpecification 商品规格
     * @return 结果
     */
    @Override
    public int insertProductSpecification(ProductSpecification productSpecification)
    {
        return productSpecificationMapper.insertProductSpecification(productSpecification);
    }

    /**
     * 修改商品规格
     *
     * @param productSpecification 商品规格
     * @return 结果
     */
    @Override
    public int updateProductSpecification(ProductSpecification productSpecification)
    {
        productSpecification.setUpdateTime(DateUtils.getNowDate());
        return productSpecificationMapper.updateProductSpecification(productSpecification);
    }

    /**
     * 通过id批量删除商品规格信息
     *
     * @param ids 需要删除的商品规格主键
     * @return 结果
     */
    @Override
    public int deleteProductSpecificationByIds(Long[] ids)
    {
        return productSpecificationMapper.deleteProductSpecificationByIds(ids);
    }

    /**
     * 通过id删除商品规格信息
     *
     * @param id 商品规格主键
     * @return 结果
     */
    @Override
    public int deleteProductSpecificationById(Long id)
    {
        return productSpecificationMapper.deleteProductSpecificationById(id);
    }
}
